package com.learn.prototype.protoyype;

import lombok.Getter;

/**
 * <p>项目名称: design-pattern </p>
 *
 * <p>文件名称: FactoryImpl </p>
 */
@Getter
public class FactoryImpl implements Factory {
    private Table table;
    private Line line;

    public FactoryImpl(Table table, Line line) {
        this.table = table;
        this.line = line;
    }

    @Override
    public Table createTable() {
        try {
            return table.copy();
        } catch (CloneNotSupportedException e) {
            return null;
        }
    }

    @Override
    public Line createLine() {
        try {
            return line.copy();
        } catch (CloneNotSupportedException e) {
            return null;
        }
    }
}
